package com.itboye.jinpuyiyuan.activity.home.finddoctor;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.jinpuyiyuan.R;
import com.itboye.jinpuyiyuan.adapter.FindDoctorArrayAdapter;
import com.itboye.jinpuyiyuan.adapter.LeftAdapter;
import com.itboye.jinpuyiyuan.adapter.RegisterDoctorDetailAdapter;
import com.itboye.jinpuyiyuan.base.BaseActivity;
import com.itboye.jinpuyiyuan.bean.BranchBean;
import com.itboye.jinpuyiyuan.bean.BranchDepartmentBeanNew;
import com.itboye.jinpuyiyuan.bean.QueryDoctorListBean;
import com.itboye.jinpuyiyuan.bean.QueryDoctorListBeanNew;
import com.itboye.jinpuyiyuan.bean.RegisterDoctorDetail;
import com.itboye.jinpuyiyuan.presenter.BranchAddressPresenter;
import com.itboye.jinpuyiyuan.utils.LocationUtils;
import com.itboye.jinpuyiyuan.utils.volley.ResultEntity;
import com.itboye.jinpuyiyuan.widget.AutoResizeTextView;
import com.itboye.jinpuyiyuan.widget.loadingutil.MAlert;
import com.scwang.smartrefresh.header.MaterialHeader;
import com.scwang.smartrefresh.header.WaterDropHeader;
import com.scwang.smartrefresh.header.WaveSwipeHeader;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreater;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreater;
import com.scwang.smartrefresh.layout.api.RefreshFooter;
import com.scwang.smartrefresh.layout.api.RefreshHeader;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.constant.SpinnerStyle;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
import com.scwang.smartrefresh.layout.listener.OnLoadmoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;


import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

/**
 * Created by Administrator on 2017/12/11 0011.
 */

public class FindDoctorActivity extends BaseActivity implements Observer {
    //title
    private ImageView leftImg,rightImg;
    private TextView leftTv,tvTitle;
    private RelativeLayout rlLeft,toobar;
    private AutoResizeTextView branchSelect,typeSelect,departmentSelect;
    private TextView branchSelectTv,typeSelectTv,departmentSelectTv;
    private ListView findDoctorList,branchList,departmentList,typeList;
    private LinearLayout branchLL,typeLL,departmentLL,branchSelectLL,typeSelectLL,departmentSelectLL;
    private SmartRefreshLayout refresh;

    private EditText searchEt;
    private TextView searchTv;
    private ImageView movableLine;
    private int moveDistance;//移动的距离
    private int currIndex;

    private int num;//记录点击次数
    private int id=0;//记录点击的view id
    private ArrayList<String> branchArray,departmentArray,typeArray;
    private ArrayList<QueryDoctorListBeanNew.DoctorItem> doctorList;
    private RegisterDoctorDetailAdapter registerDoctorDetailAdapter;
    private FindDoctorArrayAdapter branchAdapter,departmentAdapter,typeAdapter;
    private BranchAddressPresenter presenter;

    //分院
    private ArrayList<BranchBean.ListInfo> branchs;
    //departments 科室  consltation 诊室
    private ArrayList<BranchDepartmentBeanNew.DepartmentChild> departments,consultations;
    private String departmentId="";
    private String branchId="";
    private String cid="";
  //type  1 查询科室  2 查询诊室
    private int type=0;

    //医院分院

    //科室

    //诊室
    @Override
    protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        setContentView(R.layout.activity_finddoctor);
        initView();
        initViewData();
        caozuo();
        currIndex=0;
        Log.d("==========",moveDistance+"");


    }

    private void initView() {
        rightImg.setVisibility(View.GONE);
        leftTv.setVisibility(View.GONE);
        tvTitle.setText("金普名医");
        branchLL.setVisibility(View.GONE);
        departmentLL.setVisibility(View.GONE);
        typeLL.setVisibility(View.GONE);

        branchArray=new ArrayList<>();
        departmentArray=new ArrayList<>();
        doctorList=new ArrayList<>();
        typeArray=new ArrayList<>();
        branchs= new ArrayList<>();
        departments = new ArrayList<>();
        consultations = new ArrayList<>();
        presenter=new BranchAddressPresenter(this);

        //分院查询
        String lngAndLatWithNetwork = new LocationUtils().getLngAndLat(this);
        presenter.queryBranch(lngAndLatWithNetwork.split(",")[0],lngAndLatWithNetwork.split(",")[1]);//分院查询


//        doct_type类型,0=>未分配,1=>门诊,2=>住院,3=>体验,其他=>全部
//        presenter.queryDoctor("","","",7,1,10);//查询所有的医生
        registerDoctorDetailAdapter=new RegisterDoctorDetailAdapter(this,doctorList);
        findDoctorList.setAdapter(registerDoctorDetailAdapter);
        searchEt.setOnEditorActionListener(new TextView.OnEditorActionListener() {

            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                //当actionId == XX_SEND 或者 XX_DONE时都触发
                //或者event.getKeyCode == ENTER 且 event.getAction == ACTION_DOWN时也触发
                //注意，这是一定要判断event != null。因为在某些输入法上会返回null。
                if (actionId == EditorInfo.IME_ACTION_SEND
                        || actionId == EditorInfo.IME_ACTION_DONE
                        || (event != null &&
                        KeyEvent.KEYCODE_ENTER == event.getKeyCode()
                        && KeyEvent.ACTION_DOWN == event.getAction())) {
                    //处理事件
                    if (!searchEt.getText().toString().equals("")){
                        presenter.queryDoctor("","","","","",searchEt.getText().toString().trim());
                        return true;
                    }
                }
                return false;
            }
        });
    }

    private void caozuo(){

        refresh.setEnableAutoLoadmore(true);//开启自动加载功能（非必须）

//        //        //触发自动刷新
//        refresh.autoRefresh();
//        refresh.setOnRefreshListener(new OnRefreshListener() {
//            @Override
//            public void onRefresh(RefreshLayout refreshlayout) {
//                refreshlayout.getLayout().postDelayed(new Runnable() {
//                    @Override
//                    public void run() {
//                        pageNo = 1;
//                        userPresenter.getSystemMess(uid, type + "", pageNo + "", "10");
//                    }
//                }, 0);
//            }
//        });
//
//        //进行加载更多的逻辑处理
//        refresh.setOnLoadmoreListener(new OnLoadmoreListener() {
//            @Override
//            public void onLoadmore(RefreshLayout refreshlayout) {
//                refreshlayout.getLayout().postDelayed(new Runnable() {
//                    @Override
//                    public void run() {
//                        pageNo++;
//                        userPresenter.getSystemMess(uid, type + "", pageNo + "", "10");
//                    }
//                }, 0);
//            }
//        });

//        //设置头布局样式,全局有效
//        refresh.setDefaultRefreshHeaderCreater(new DefaultRefreshHeaderCreater() {
//            @Override
//            public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
//                //全局设置主题颜色
//                layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white);
//                //指定为经典Header，默认是 贝塞尔雷达Header
//                return new WaterDropHeader(context);
////                return new ClassicsHeader(context).setSpinnerStyle(SpinnerStyle.Translate);
//            }
//        });
//        //设置脚布局样式,全局有效
//        refresh.setDefaultRefreshFooterCreater(new DefaultRefreshFooterCreater() {
//            @Override
//            public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
//                //指定为经典Footer，默认是 BallPulseFooter
//                return new ClassicsFooter(context).setSpinnerStyle(SpinnerStyle.Translate);
//            }
//        });

        WaveSwipeHeader waveSwipeHeader = new WaveSwipeHeader(this);
        waveSwipeHeader.setColorSchemeColors(getResources().getColor(R.color.colorAccent));
        refresh.setRefreshHeader(waveSwipeHeader);
        //  refresh.setRefreshFooter(new BallPulseFooter(this).setSpinnerStyle(SpinnerStyle.Scale));

    }


    private void initViewData() {

        branchList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                cancleTableState();
                branchId=branchs.get(position).getId();
                branchSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
                branchSelect.setTextColor(getResources().getColor(R.color.title_blue));
//                branchSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                branchSelectTv.setText(branchArray.get(position));
                branchSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);
                branchLL.setVisibility(View.GONE);
                departmentSelectTv.setText("");
                typeSelectTv.setText("");
                type=1;
                presenter.queryDepartment(branchs.get(position).getId()+"","0");
                presenter.queryDoctor(branchId,"","","","","");
            }
        });
        typeList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                cancleTableState();
                typeSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
                typeSelect.setTextColor(getResources().getColor(R.color.title_blue));
                typeSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);
//                typeSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                typeSelectTv.setText(typeArray.get(position));
                typeLL.setVisibility(View.GONE);
                departmentId=consultations.get(position).getDept_id();
                presenter.queryDoctor(branchId+"",cid,departmentId+"","","","");
            }
        });
        departmentList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                cancleTableState();
                cid=departments.get(position).getDept_id();
                departmentSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
                departmentSelect.setTextColor(getResources().getColor(R.color.title_blue));
                departmentSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);
//                departmentSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                departmentSelectTv.setText(departmentArray.get(position));
                departmentLL.setVisibility(View.GONE);
                typeSelectTv.setText("");
                presenter.queryDoctor(branchId+"",cid+"","","","","");
                type=2;
                presenter.queryDepartment(branchId+"",departments.get(position).getDept_id()+"");
            }
        });

        findDoctorList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent(FindDoctorActivity.this, DoctorDetailActivity.class);
                if (doctorList.get(position).getUid().equals("")||doctorList.get(position).getUid()==null){
                    MAlert.alert("该医生数据异常");
                }else {
                    intent.putExtra("doctorId",doctorList.get(position).getUid()+"");
                    intent.putExtra("doctorName",doctorList.get(position).getName());
                    startActivity(intent);
                }

            }
        });


    }

    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()){
            case R.id.rlLeft:
            case R.id.leftImg:
                this.finish();
                break;
            case R.id.branchSelect:
            case R.id.branchSelectTv:
                cancleTableState();
                tranSlate(0,300);
                branchLL.setVisibility(View.VISIBLE);
                departmentLL.setVisibility(View.GONE);
                typeLL.setVisibility(View.GONE);
                branchSelect.setTextColor(getResources().getColor(R.color.title_blue));
                branchSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
                branchSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.less),null);
//                branchSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                currIndex=0;

                break;
            case R.id.typeSelect:
            case R.id.typeSelectTv:
                cancleTableState();
                tranSlate(2,300);
                typeLL.setVisibility(View.VISIBLE);

                branchLL.setVisibility(View.GONE);
                departmentLL.setVisibility(View.GONE);
                typeSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.less),null);
                typeSelect.setTextColor(getResources().getColor(R.color.title_blue));
                typeSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
//                typeSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                currIndex=2;
                break;
            case R.id.departmentSelect:
            case R.id.departmentSelectTv:
                cancleTableState();
                tranSlate(1,300);

                departmentLL.setVisibility(View.VISIBLE);
                branchLL.setVisibility(View.GONE);
                typeLL.setVisibility(View.GONE);

                departmentSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.less),null);
                departmentSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
//                departmentSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));

                //                departmentSelectTv.setCompoundDrawables();
                departmentSelect.setTextColor(getResources().getColor(R.color.title_blue));
                currIndex=1;
                break;
            case R.id.branchLL:
                if (branchLL.getVisibility()==View.VISIBLE){
                    branchSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
                    branchSelect.setTextColor(getResources().getColor(R.color.title_blue));
//                branchSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                    branchSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);
                    branchLL.setVisibility(View.GONE);
                }

            case R.id.departmentLL:
                if (departmentLL.getVisibility()==View.VISIBLE){
                    departmentSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
                    departmentSelect.setTextColor(getResources().getColor(R.color.title_blue));
                    departmentSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);
//                departmentSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                    departmentLL.setVisibility(View.GONE);
                }
                break;
            case R.id.typeLL:
                if (typeLL.getVisibility()==View.VISIBLE){
                    typeSelectTv.setTextColor(getResources().getColor(R.color.title_blue));
                    typeSelect.setTextColor(getResources().getColor(R.color.title_blue));
                    typeSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);
//                typeSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_blueedge));
                    typeLL.setVisibility(View.GONE);
                }
                break;

            case R.id.searchTv:
                if (searchEt.getText().toString().equals("")){
                    MAlert.alert("搜索医生姓名不能为空");
                    return;
                }
                presenter.queryDoctor("","","","","",searchEt.getText().toString().trim());
                break;
        }
    }

    /**
     * 平移动画
     *
     * @param currentItem
     * @param durationMillis
     */
    public void tranSlate(int currentItem, long durationMillis) {
        float one = moveDistance;
        Log.v("offest", "" + moveDistance);
        Animation animation = new TranslateAnimation(currIndex * one,
                currentItem * one, 0, 0);// 平移动画
        Log.v("currentoffest", "" + currIndex * one);
        Log.v("currentItem", "" + currentItem * one);
        animation.setFillAfter(true);// 动画终止时停留在最后一帧，不然会回到没有执行前的状态
        animation.setDuration(durationMillis);// 动画持续时间0.2秒
        movableLine.startAnimation(animation);// 是用ImageView来显示动画的
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        moveDistance = branchSelectLL.getMeasuredWidth();
        RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(moveDistance,4);
        params.addRule(RelativeLayout.ALIGN_BOTTOM,R.id.selectLL);
        movableLine.setLayoutParams(params);
        num=0;
        Log.d("==========",moveDistance+"");
    }

    public void cancleTableState(){
        branchSelect.setTextColor(getResources().getColor(R.color.black));
        branchSelectTv.setTextColor(getResources().getColor(R.color.black));
//        branchSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_grayedge));
        branchSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);

        typeSelect.setTextColor(getResources().getColor(R.color.black));
        typeSelectTv.setTextColor(getResources().getColor(R.color.black));
//        typeSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_grayedge));
        typeSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);

        departmentSelect.setTextColor(getResources().getColor(R.color.black));
        departmentSelectTv.setTextColor(getResources().getColor(R.color.black));
//        departmentSelectTv.setBackgroundDrawable(getResources().getDrawable(R.drawable.login_corner_grayedge));
        departmentSelectTv.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.jinpumingyi_jiantou),null);
    }

//    //分院筛选和种类筛选和科室筛选的点击逻辑
//    public void isClickShowView(View view){
//      num++;
//        if (id==view.getId()||id==0){
//
//        }else {
//         num++;
//        }
//      if (num%2==0){
//         view.setVisibility(View.GONE);
//      }else {
//          view.setVisibility(View.VISIBLE);
//      }
//        id=view.getId();
//    }


    @Override
    public void update(Observable o, Object arg) {
        ResultEntity resultEntity = handlerError(arg);
        if (resultEntity!=null){

            //结束加载
            refresh.finishRefresh();
            //结束上拉加载
            refresh.finishLoadmore();

            if (resultEntity.getEventType()==BranchAddressPresenter.By_HospDoct_query_success){
//                MAlert.alert("查询医师成功");
                if (doctorList.size()>0){
                    doctorList.clear();
                }

                QueryDoctorListBeanNew queryDoctorListBean= (QueryDoctorListBeanNew) resultEntity.getData();
                for (int i=0;i<queryDoctorListBean.getList().size();i++){
                    if (!queryDoctorListBean.getList().get(i).getUid().equals("0")){
                        doctorList.add(queryDoctorListBean.getList().get(i));
                    }
                }
                registerDoctorDetailAdapter.addData(doctorList);
            }else if (resultEntity.getEventType()==BranchAddressPresenter.By_HospDoct_query_fail){

//                MAlert.alert("查询医师失败");
            }else if (resultEntity.getEventType() == BranchAddressPresenter.queryAddress_success) {
//                MAlert.alert("请求成功");
                BranchBean bean = (BranchBean) resultEntity.getData();
                if (branchArray.size()>0){
                    branchArray.clear();
                }
                if (branchs.size()>0){
                    branchs.clear();
                }
//
                Log.d("======up",bean.toString());
                for (int i=0;i<bean.getList().size();i++){
                    branchs.add(bean.getList().get(i));
                    branchArray.add(bean.getList().get(i).getName());
                }
//                branchSelectTv.setText(branchArray.get(0));
                branchId=branchs.get(0).getId();
                branchAdapter=new FindDoctorArrayAdapter(this,branchArray);
                branchList.setAdapter(branchAdapter);
//
                //查询科室
//                type=1;
//                presenter.queryDepartment(bean.getList().get(0).getId()+"","0");
            } else if (resultEntity.getEventType() == BranchAddressPresenter.queryAddress_fail) {
//                MAlert.alert(entity.getMsg(), Gravity.TOP);
            }else if (resultEntity.getEventType()== BranchAddressPresenter.By_HospSect_query_success){
//                MAlert.alert("科室查询成功");
                if (type==1){//科室

                    if (departmentArray.size()>0){
                        departmentArray.clear();
                    }
                    if (departments.size()>0){
                        departments.clear();
                    }
                    for (int i=0;i< ((List<BranchDepartmentBeanNew>) resultEntity.getData()).get(0).getSect_list().size();i++){
                        departmentArray.add(((List<BranchDepartmentBeanNew>) resultEntity.getData()).get(0).getSect_list().get(i).getDept_name());
                        departments.add(((List<BranchDepartmentBeanNew>) resultEntity.getData()).get(0).getSect_list().get(i));
                    }
                    departmentAdapter=new FindDoctorArrayAdapter(this,departmentArray);
                    departmentList.setAdapter(departmentAdapter);

//                    if (departmentArray.size()>0){
////                        departmentSelectTv.setText(departmentArray.get(0));
//                        departmentId=departments.get(0).getDept_id();
//                        type=2;
//                        presenter.queryDepartment(branchId+"",departments.get(0).getDept_id());
////                        presenter.queryDoctor(branchId+"",departmentId+"",1,10,"");
//                    }else {//没有科室
////                        departmentSelectTv.setText("");
//                        presenter.queryDoctor(branchId+"","",1,10,"");
//                        if (typeArray.size()>0){
//                            typeArray.clear();
//                        }
//                        if (typeAdapter!=null){
//                            typeAdapter.addData(typeArray);
//                            typeSelectTv.setText("");
//                        }else {
//                            typeAdapter=new FindDoctorArrayAdapter(this,typeArray);
//                            typeList.setAdapter(typeAdapter);
//                        }
//                    }
                }else {
                    if (typeArray.size()>0){
                        typeArray.clear();
                    }
                    if (consultations.size()>0){
                        consultations.clear();
                    }
                    for (int i=0;i< ((List<BranchDepartmentBeanNew>) resultEntity.getData()).get(0).getSect_list().size();i++){
                        typeArray.add(((List<BranchDepartmentBeanNew>) resultEntity.getData()).get(0).getSect_list().get(i).getDept_name());
                        consultations.add(((List<BranchDepartmentBeanNew>) resultEntity.getData()).get(0).getSect_list().get(i));
                    }
                    if (typeArray.size()>0){
//                        typeSelectTv.setText(typeArray.get(0));
//                        departmentId=Integer.parseInt(consultations.get(0).getDept_id());
                    }else {
//                        typeSelectTv.setText("");
                    }

                    if (typeAdapter!=null){
                        typeAdapter.addData(typeArray);
                    }else {
                        typeAdapter=new FindDoctorArrayAdapter(this,typeArray);
                        typeList.setAdapter(typeAdapter);
                    }


                }

                //查询医生
//                presenter.queryDoctor("",branchId+"",departmentId+"",0,1,10);

            }else if (resultEntity.getEventType() == BranchAddressPresenter.By_HospSect_query_fail){
//                MAlert.alert("科室查询失败");
            }
        }
    }
}
